﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FeatureDetection.Converter {
    public class NumOfFrameConverter : System.Windows.Data.IMultiValueConverter{
        #region IMultiValueConverter メンバー

        public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture) {
            if(values.Count() != 2) return double.NaN;
            if(values[0] == null | values[1] == null) return double.NaN;
            var num = (double)values[0] - (double)values[1] + 1;
            if(num <= 0) num = double.NaN;
            return num;
        }

        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture) {
            throw new NotImplementedException();
        }

        #endregion
    }
}
